GBML manual / Effects

light_scale

Makes this object’s light bigger or smaller: `scale` multiplies the size set in Gbabel (1 is as set, 2 twice as far and as wide, 0.5 half, 0 as good as off). The light grows and shrinks about its own origin, which never moves. It does nothing on an object that is not set as a light.

Works differently on Game Boy - Makes the light bigger or smaller about its origin, from a quarter to about 8 times its size, and 0 puts it out. The Game Boy tells which sprites stand in the shape. Up to 4 lights.

Works differently on Game Boy Color - Makes the light bigger or smaller about its origin, from a quarter to about 8 times its size, and 0 puts it out. The Game Boy Color lights whole 8 by 8 pixel squares. Up to 4 lights, a picture of 3 palettes at most and 4 sprite palettes at most.

Works differently on Sega Genesis - The Sega Genesis has one dark level: half as bright as the picture. Every darkness number above 0 shows that same dark (a room set to 72 is no darker than one set to 50), and 0 is no dark at all. Each light cuts its hole in that dark, in the shape and size set in Gbabel and in the directions and sizes the code asks for; a light's hole is a picture made ahead of time, so a size or a direction the code works out while the game plays is shown as the nearest one made. An object stands in the light as a whole while its middle is in the light. A light near the edge of the screen is whole or gone, and an object lit by room lights keeps its own colors.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

light_scale(scale)

Arguments

NameType
scalereal

Returns

Nothing.

Description

Makes this object's light bigger or smaller. scale multiplies the size set in the Adjust... window: 1 is exactly as set, 2 reaches twice as far and is twice as wide, 0.5 half as much, and 0 is as good as off. It is the call for a fire that flares up and dies back, a lamp that dims, a torch that burns low, a searchlight that opens out.

The light grows and shrinks about its own origin, the point you placed in the Adjust window, and the origin never moves. A lamp stays in its lantern; a cone gets longer from the same tip.

An object lit by the light is tested against the scaled shape, so a fire that flares lights a character who was just outside its normal reach.

The call does nothing on an object whose Lighting setting is not This is a light; Gbabel notes it, and the build goes on.

Keep it modest

The picture of a light's hole is made at one size, ahead of time, and the console scales it. Past about 2 the dithered edge grows coarse and the console stops showing the whole of a larger shape. If a light needs to be that much bigger, give it a bigger Reach in the Adjust window and scale from there.

Example

if (btn_held(BTN_A)) { light_scale(1.5); } else { light_scale(1); }

The light is one and a half times its set size while A is held, and back at its set size the moment it is let go.

A real capture, two pictures of one fire - its light at the size set in Gbabel, then the same light flared to a third larger, reaching farther over the footpath with the walker inside itA real capture, two pictures of one fire - its light at the size set in Gbabel, then the same light flared to a third larger, reaching farther over the footpath with the walker inside it
A real capture, two pictures of one fire - its light at the size set in Gbabel, then the same light flared to a third larger, reaching farther over the footpath with the walker inside it

On the GBA

The picture of the light’s hole is made at one size ahead of time and scaled by the hardware, so a light grown past what was set shows the dithered edge coarser, and the hardware shows a scaled picture only up to double its drawn size: ask for more than about 2 and the edge of the shape is clipped. The objects the light reaches are tested against the scaled shape.

See also: light_onlight_rotatelight_flickerRoom lightingshroud_cutout